package design_pattern.ActiveObjects;

/**
 * @Author: 蔡翔
 * @Date: 2019/11/22 13:48
 * @Version 1.0
 */
public class Servant implements ActiveObject {
    @Override
    public Result makeString(int count, char fillChar) {
        char[] buf = new char[count];
        for(int i = 0;i<count;i++){
            buf[i] = fillChar;
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {

            }

        }
        return new RealResult(new String(buf));
    }

    @Override
    public void displayString(String text) {
        try {
            System.out.println("Display :"+text);
            Thread.sleep(10);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
